package com.iuie.ns.devtools.element;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ResultMapUpdateElement extends ResultMapOperationElement {
	
	public static final Map<String, String> COMMENTS = new HashMap<String, String>() {

		private static final long serialVersionUID = 5287064379335365496L;
		
		{
			put("updateOne", "更新单条记录");
			put("batchUpdate", "批量更新");
		}
	};
	
	@Override
	protected String getPrefix() {
		StringBuilder sb = new StringBuilder(12);
		sb.append("\n\t<!-- ")
			.append(COMMENTS.get(this.getOperation()))
			.append(" -->")
			.append("\n\t<update ")
			.append("id=\"")
			.append(this.getOperation())
			.append("\"")
			.append(">\n");
		return sb.toString();
	}

	@Override
	protected String getSuffix() {
		return "\n\t</update>\n";
	}

	@Override
	protected List<DevElement> getChildren() {
		List<DevElement> list = new ArrayList<>(1);
		list.add(new SQLUpdateElement(this));
		return list;
	}

}
